package nowCoder;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class HJ31 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String x = in.nextLine();
        ArrayList<String> l = new ArrayList<>();
        int n = 0;
        for (int i = 0; i < x.length(); i++) {
            int xx = x.charAt(i);
            if ((xx >= 65 && xx<=90 )||(xx>=97 && xx<=122)){
                n++;
            }else if (n != 0){
                l.add(x.substring(i-n,i));
                n = 0;
            }
        }
        l.add(x.substring(x.length()-n));
        Collections.reverse(l);
        for (String s : l) {
            System.out.print(s + " ");
        }
    }
}
